<template>
	<view style="background-color: #ededed; height: 100%;">
		<view>
			<view
				:style="{border:'solid',borderColor:' #ededed',borderRadius: '15rpx',backgroundImage:`url(${BeijingURL})`,backgroundSize:'cover'}">
				<view style="display: flex; margin: 48rpx;" @click="test">
					<u--image :src="avatarURL" width="155rpx" height="155rpx" radius="10"></u--image>
					<view style="display: flex; flex-direction: column; margin-left: 20rpx;margin-top: 8rpx;">
						<span style="font-size: 40rpx; font-weight: bold;">{{user.nickname}}</span>
						<span style="color: #898a8b;margin-top: 20rpx;">学号：{{user.studentID}}</span>
					</view>
				</view>
			</view>
			<view style="margin-top: 70rpx;">
				<u-cell-group style="background-color: #ffffff;">
					<u-cell @click="geren" size="large" :icon="GerenURL" title="个人信息" isLink titleStyle="margin-left: 20rpx;"></u-cell>
					<u-cell @click="records" size="large" :icon="CepingURL" title="测评结果" isLink titleStyle="margin-left: 20rpx;"></u-cell>
				</u-cell-group>
			</view>
			<view style="margin-top: 70rpx;">
				<u-cell-group style="background-color: #ffffff;">
					<u-cell @click="changePhone" size="large" :icon="ShoujURL" title="修改手机号" isLink titleStyle="margin-left: 20rpx;"></u-cell>
			<!-- v-if -->		
					<u-cell @click="changePassword" size="large" :icon="MimaURL" title="修改密码" v-if="iswxlogin===0" isLink titleStyle="margin-left: 20rpx;"></u-cell>
				</u-cell-group>
				<view>
					<u-popup :show="show" :round="10" mode="center" @close="close" @open="open">
						<view class="lianx">
							<h3 class="lianxT">老师电话</h3>
							<view style="margin-top: 20rpx;">
								<p>指导员<span>{{lianxi.zhid}}</span></p>
								<p>心理老师<span>{{lianxi.xinl}}</span></p>
								<p>职业规划老师<span>{{lianxi.zhiy}}</span></p>
							</view>
						</view>
						
					</u-popup>
					<u-cell-group style="background-color: #ffffff;">
						<u-cell :value=xuej :icon="DianhURL" size="large" title="联系电话" titleStyle="margin-left: 20rpx;" @click="show = true"
							isLink></u-cell>
					</u-cell-group>
				</view>
			</view>
		</view>
		<view style="margin: 70rpx;" class="dl" @click="btnClick">
			<u-button type="primary" text="退出登陆"  color="#5c9fef"></u-button>
		</view>
	</view>
</template>

<script>
	import {mapState,mapMutations} from 'vuex'
	import { getwxuserInfo } from '../../../api/myModel' 
	export default {
		data() {
			return {
				avatarURL:this.$baseURL + '/profile/upload/2025/05/10/toux_20250507173931A085_20250510150511A046.jpg',
				BeijingURL:this.$baseURL + '/profile/upload/2025/05/10/beijing_20250507093635A014_20250510145942A010.png',
				GerenURL:this.$baseURL + '/profile/upload/2025/05/10/gerxx_20250507100956A027_20250510150108A021.png',
				CepingURL:this.$baseURL + '/profile/upload/2025/05/10/cepjg_20250507093645A015_20250510145955A012.png',
				ShoujURL:this.$baseURL + '/profile/upload/2025/05/10/xuigsjh_20250507101100A031_20250510150556A048.png',
				MimaURL:this.$baseURL + '/profile/upload/2025/05/10/xuigmm_20250507101052A030_20250510150524A047.png',
				DianhURL:this.$baseURL + '/profile/upload/2025/05/10/dianh_20250507100844A022_20250510150036A018.png',

				background: this.$baseURL + '/profile/upload/2025/05/07/image4_20250507095002A021.jpg',

				show: false,
				// user: {
				// 	headerUrl: '/static/toux.jpg',
				// 	name: '用户名',
				// 	dept: '1223787238'
				// },
				
				//后端反过来的数据 
				user: {
					avatar: '',//头像
					birth: "",//出生日期
					degreeGrade: "",//学历等级
					degreeType: "",//学历类型
					enterSchoolYear: "",//入学日期
					name: '',//姓名
					nickname: "",//昵称
					schoolStatu: "",//学籍状态
					sex: 0,
					studentID: "",
					telephone: ""
				},
				
				
				lianxi: {
					zhid: '12345678912',
					xinl: '12345678912',
					zhiy: '12345678912',
				}


			}
		},
		computed:{
			...mapState(['iswxlogin'])//利用扩展运算符扩展对象    mapState生成的计算属性  iswxlogin()：this.$store.state.iswxlogin  
		},
		
		created(){
			getwxuserInfo().then((res)=>{
				this.user=res.data
			})
		},
		
		methods: {
			
			...mapMutations(["holdIswxlogin"]),//扩展的仓库里的方法，相当于把仓库里的方法直接移过来了，不需要再使用 this.$store.commint("方法名"，n)的形式了
			open() {
				// console.log('open');
			},
			close() {
				this.show = !this.show;
				// console.log('close');
			},
			test(){
				
			},
			//个人信息
			geren(){
				// let test= encodeURIComponent(JSON.stringify(this.user) ) 
				// console.log(decodeURIComponent(test))
				// 传参数传整个user对象
				uni.navigateTo({	
					url: '/pages/myModel/geren/geren?user='+ encodeURIComponent(JSON.stringify(this.user)) 
				});
			},
			//测评结果
			records(){
				uni.navigateTo({
					url: '/pages/myModel/records/records'
				});
			},
			//修改手机号
			changePhone(){
				uni.navigateTo({
					url:`/pages/myModel/changePhone2/changePhone2?telephone=${this.user.telephone}`
				});
			},
			//修改密码
			changePassword(){
				// 传参数只需要一个手机号
				uni.navigateTo({
					// 字符串后边加一个？表示后边该传参数了。
					url: `/pages/myModel/changePassword/changePassword?telephone=${this.user.telephone}`
				});
			},
			//退出登录
			btnClick() {
				// 清除token
				uni.removeStorageSync("token")
				uni.navigateTo({
					url: '/pages/loginModel/login/login'
				});
			},
		}
	}
</script>

<style>
	.u-cell__body--large.data-v-913eaa32 {
		background-color: #ffffff;
	}

	.dianh {
		height: 100rpx;
	}

	.lianx {
		width: 600rpx;
		height: 480rpx;
		background-color: #e1dfdf;
		font-size: 35rpx;
	}

	.lianxT {
		background-color: #cdf1ff;
		height: 60rpx;
		text-align: center;
		padding-top: 10rpx;

	}

	.lianx p {
		height: 90rpx;
		width: 540rpx;
		background-color: #ffffff;
		text-align: center;
		margin-left: 20rpx;
		padding-left: 20rpx;
		padding-top: 30rpx;
		margin-bottom: 10rpx;
		border-radius: 10rpx;
	}

	.lianx p span {
		float: right;
		padding-right: 100rpx;
	}
</style>